package liwq;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author : liwq
 * @version : 1.0
 * @date : 2023/4/26
 **/
public class Liwq1 {
    public static void reOrderArray(int array[]) {

        if (array == null || array.length == 0) {
            return;
        }

        List<Integer> list = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();


        for (int i = 0; i < array.length; i++) {
            if (isEven(array[i])) {
                list.add(array[i]);

            } else {
                list2.add(array[i]);

            }
        }
        list.addAll(list2);

        System.out.println(list.toString());


    }


    public static boolean isEven(int i) {
        if (i % 2 == 0) {
            return true;
        }
        return false;
    }


    public static int reverse(int x) {
        int rev = 0;
        while (x != 0) {
            if (rev < Integer.MIN_VALUE / 10 || rev > Integer.MAX_VALUE / 10) {
                return 0;
            }
            int digit = x % 10;
            x /= 10;
            rev = rev * 10 + digit;
        }
        return rev;
    }


    public static void main(String[] args) {
//        int a[] = {2, 1, 6, 8, 9, 13, 56, 98, 13};
//        reOrderArray(a);
//        System.out.println(Arrays.toString(a));

        System.out.println(reverse(12342));
    }
}
